package com.sell.demo.mapper.good;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.sell.demo.entity.Food;

/**
 * 城市 DAO 接口类
 *
 * Created by xchunzhao on 02/05/2017.
 */
@Mapper // 标志为 Mybatis 的 Mapper
public interface FoodMapper {

    /**
     * 根据城市名称，查询城市信息
     *
     * @param cityName 城市名
     */
//    @Select("SELECT * FROM city")
    // 返回 Map 结果集
//    @Results({
//            @Result(property = "id", column = "id"),
//            @Result(property = "provinceId", column = "province_id"),
//            @Result(property = "cityName", column = "city_name"),
//            @Result(property = "description", column = "description"),
//    })
//    City findByName(@Param("cityName") String cityName);
	
	
	/**
     * 根据城市名称，查询城市信息
     *
     * @param cityName 城市名
     */
    @Select("SELECT * FROM food where good_id = #{goodId}")
     //返回 Map 结果集
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "name", column = "name"),
            @Result(property = "price", column = "price"),
    })
    List<Food> getFoodList(@Param("goodId") String goodId);
}
